import React, { Component } from "react";
import { HashRouter, Route, Redirect, Switch } from "react-router-dom";

import Tabbar from "./components/Tabbar";
import Home from "./components/Home"
import Category from "./components/Category"
import Cart from "./components/Cart"
import My from "./components/My"
import SearchCenter from "./components/Search/SearchCenter";
import GoodsDetail from "./components/GoodsDetail"
import GoodsList from "./components/GoodsList";

export default class App extends Component {
  render() {
    return (
      <div>
         <HashRouter>
          <Switch>
            <Route exact path="/home" render={(props)=><Tabbar {...props}><Home></Home></Tabbar>}></Route>
            <Route exact path="/category" render={(props)=><Tabbar {...props}><Category></Category></Tabbar>}></Route>
            <Route exact path="/cart" render={(props)=><Tabbar {...props}><Cart></Cart></Tabbar>}></Route>
            <Route exact path="/my" render={(props)=><Tabbar {...props}><My></My></Tabbar>}></Route>
            <Route exact path="/searchCenter" render={(props)=><SearchCenter></SearchCenter>}></Route>
            <Route exact path="/goodDetail/:goods_id" render={(props)=><GoodsDetail></GoodsDetail>}></Route>
            <Route exact path="/goodList" render={(props)=><GoodsList {...props}></GoodsList>}></Route>
            <Redirect from= "/" to="/home"></Redirect>
          </Switch>
        </HashRouter>
      </div>
    )
  }
}
